package com.service.bean;

import java.sql.Timestamp;
import java.text.MessageFormat;

/**
 * 摊铺机
 * @author wt
 *
 */
public class Road_GpsSignal_Paver extends Road_GpsSignal {

	// ---------------------以下为基础值--------------------------

	/**
	 * 熨平板温度
	 */
	public double ironPlateTemp;
	/**
	 * 路面温度
	 */
	public double paverTemp;
	/**
	 * 路面厚度
	 */
	public double thickness;
	/**
	 * 平整度
	 */
	public double evenness;
	/**
	 * 夯锤转速
	 */
	public double ramSpeed;
	/**
	 * 震动转速
	 */
	public double vibrationSpeed;
	/**
	 * 开关位
	 */
	public long rawSwitch;
	public String rfid;

	public Object[] getAll() {
		Object[] array = new Object[21];
		array[0] = "'"  + this.signalId + "'";
		array[1] = "'" + this.equipmentId + "'";
		array[2] = "'" + this.gpsNo + "'";
		array[3] = this.gpsTime == null ? this.gpsTime : "'" + new Timestamp(this.gpsTime.getTime()) + "'";
		array[4] = String.valueOf(this.lng);
		array[5] = String.valueOf(this.lat);
		array[6] = String.valueOf(this.baiduLng);
		array[7] = String.valueOf(this.baiduLat);		
		array[8] = this.accStatus;
		array[9] = String.valueOf(this.ironPlateTemp);
		array[10] = String.valueOf(this.paverTemp);		
		array[11] = String.valueOf(this.evenness);		
		array[12] = String.valueOf(this.speed);
		array[13] = String.valueOf(this.oilAmt);
		array[14] = String.valueOf(this.oilAmtCal);		//TODO
		array[15] = String.valueOf(this.ramSpeed);
		array[16] = String.valueOf(this.vibrationSpeed);
		array[17] = String.valueOf(this.thickness);
		array[18] = "'" + this.companyCode + "'";
		array[19] = String.valueOf(this.gpsStatus);
		array[20] = "'" + this.rfid + "'";

		return array;
	}
	
	public Object[] getAllForJson() {
		Object[] array = getAll();
		array[0] = "\""  + this.signalId + "\"";
		array[1] = "\""  + this.equipmentId + "\"";
		array[2] = "\"" + this.gpsNo + "\"";
		array[3] = this.gpsTime == null ? this.gpsTime : "\"" + new Timestamp(this.gpsTime.getTime()) + "\"";	
		array[18] = "\""  + this.companyCode + "\"";

		return array;
	}
	
	public String toString() {
		StringBuilder sBuilder = new StringBuilder();
		sBuilder.append("\"SignalId\":{0},");
		sBuilder.append("\"EquipmentId\":{1},");
		sBuilder.append("\"GPSNO\":{2},");
		sBuilder.append("\"GPSTime\":{3},");
		sBuilder.append("\"Lng\":{4},");
		sBuilder.append("\"Lat\":{5},");
		sBuilder.append("\"BaiduLng\":{6},");
		sBuilder.append("\"BaiduLat\":{7},");
		sBuilder.append("\"AccStatus\":{8},");		
		sBuilder.append("\"IronPlateTemp\":{9},");
		sBuilder.append("\"PaverTemp\":{10},");
		sBuilder.append("\"Evenness\":{11},");
		sBuilder.append("\"Speed\":{12},");
		sBuilder.append("\"OilAmt\":{13},");
		sBuilder.append("\"OilAmtCal\":{14},");
		sBuilder.append("\"RamSpeed\":{15},");
		sBuilder.append("\"VibrationSpeed\":{16},");
		sBuilder.append("\"Thickness\":{17},");
		sBuilder.append("\"CompanyCode\":{18},");
		sBuilder.append("\"GPSStatus\":{19}");
				
		return MessageFormat.format(sBuilder.toString(),this.getAllForJson());
	}
}
